<?php
defined('_JEXEC') or die('Restricted access'); 
 
jimport( 'joomla.html.html.tabs' );
JHtml::_('jquery.framework');
JHtml::_('behavior.keepalive');
JHTML::_('behavior.tooltip'); 
JHtml::_('behavior.framework');
JHTML::_('behavior.modal');	
?>
 
<script type="text/javascript" src="<?php echo JURI::base(true)?>/components/com_wrd/assets/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
	//<![CDATA[
	Joomla.submitbutton = function(pressbutton){
		if (pressbutton == 'redirect_to_profile') {
			submitform( pressbutton );
			return;
		}
		if (pressbutton == 'save_redemption_details') {
			submitform( pressbutton );
		}
	}

	jQuery.noConflict();
	jQuery(document).ready(function()
	{
		jQuery(".status_of_redemption").click(function(){
			jQuery(".status_of_card_date").hide();
		});
    });
	
</script>
<form  id="adminForm"  action="<?php echo JRoute::_("index.php?option=com_wrd")?>" method="post" name="adminForm" >

	<div class="col width-100">
		<fieldset class="adminform">
			<legend><?php echo JText::_('Redemption Details')?></legend>
			<table>
				<tr>
					<td class="key"><label for="title"><?php echo JText::_ ( 'Product Name' )?>:</label></td>
					<td colspan="2">
						<?php echo $this->pro_info->name ;?>
					</td>
				</tr>
				<?php if(!empty($this->pro_info->p_code)):?>
				<tr>
					<td class="key"><label for="title"><?php echo JText::_ ( 'Product Code' )?>:</label></td>
					<td colspan="2">
						<?php echo $this->pro_info->p_code ;?>
					</td>
				</tr>
				<?php endif;?>
				
				<tr>
					<td class="key"><label for="title">Quantity:</label></td>
					<td colspan="2">
						
						<?php echo $this->redemption->quantity ; ?>
					</td>
				</tr>
				
				<tr>
					<td class="key"><label for="title"><?php echo JText::_ ( 'Exchange Date' )?>:</label></td>
					<td colspan="2">
						<?php echo $this->redemption->exchange_date ; ?>
					</td>
				</tr>
				<?php if($this->redemption->point > 0):?>
				<tr>
					<td class="key"><label for="title"><?php echo JText::_ ( 'Point' )?>:</label></td>
					<td colspan="2">
						<?php echo $this->redemption->point ;?>
					</td>
				</tr>
				<?php 
					endif;
					if($this->redemption->cash > 0):
				?>
				<tr>
					<td class="key"><label for="title"><?php echo JText::_ ( 'Cash' )?>:</label></td>
					<td colspan="2">
						<?php echo $this->redemption->cash ;?>
					</td>
				</tr>
				<?php
					endif;
					if($this->redemption->approved_date != '0000-00-00 00:00:00'):
				?>
				<tr>
					<td class="key"><label for="title"><?php echo JText::_ ( 'Approved Date' )?>:</label></td>
					<td colspan="2">
						<?php echo $this->redemption->approved_date ;?>
					</td>
				</tr>
				<?php endif; ?>
				<tr>
					<td class="key"><label for="title"><?php echo JText::_ ( 'Confirmation Code' )?>:</label></td>
					<td colspan="2">
						<?php echo $this->redemption->code ;?>
					</td>
				</tr>
			</table>
			<table style='width:500px;'>
				<tr>
					<td colspan="3"><label for="title"><?php echo 'Select a status:' ; ?></label></td>
				</tr>
				<tr>
					<td width='50'>&nbsp;</td>
					<td width='150'><?php echo 'Verify with member' ; ?></td>
					<td width="100px;">
						<input type="radio" <?php echo $this->redemption->status_of_redemption == 1 ? 'checked="checked"':'';?> value="1" id="unverify" name="status_of_redemption" class="status_of_redemption" />
						<?php
							if($this->redemption->status_of_redemption == 1){	
								echo '<span class="status_of_card_date" style="color: #ff0000; padding-left: 15px;">' ;
								echo ($this->redemption->status_of_redemption_date != '0000-00-00') ? $this->redemption->status_of_redemption_date : '' ;
								echo '</span>' ;
							}
						?> &nbsp;
					</td>
				</tr>
				<tr>
					<td width='50'>&nbsp;</td>
					<td><?php echo 'Approve by loyalty program' ; ?></td>
					<td width="100px;">
						<input type="radio" <?php echo $this->redemption->status_of_redemption == 2 ? 'checked="checked"':'';?> value="2" id="approve_by_loyalty_p" name="status_of_redemption" class="status_of_redemption" />
						<?php
							if($this->redemption->status_of_redemption == 2){	
								echo '<span class="status_of_card_date" style="color: #ff0000; padding-left: 15px;">' ;
								echo ($this->redemption->status_of_redemption_date != '0000-00-00') ? $this->redemption->status_of_redemption_date : '' ;
								echo '</span>' ;
							}
						?> &nbsp;
					</td>
				</tr>
				<tr>
					<td width='50'>&nbsp;</td>
					<td><?php echo 'Approve by account' ; ?></td>
					<td width="100px;">
						<input type="radio" <?php echo $this->redemption->status_of_redemption == 3 ? 'checked="checked"':'';?> value="3" id="approve_by_account" name="status_of_redemption" class="status_of_redemption" />
						<?php
							if($this->redemption->status_of_redemption == 3){
								echo '<span class="status_of_card_date" style="color: #ff0000; padding-left: 15px;">' ;
								echo ($this->redemption->status_of_redemption_date != '0000-00-00') ? $this->redemption->status_of_redemption_date : '' ;
								echo '</span>' ;
							}
						?> &nbsp;
					</td>
				</tr>
				<tr>
					<td width='50'>&nbsp;</td>
					<td><?php echo 'Deliver to outlet' ; ?></td>
					<td width="100px;">
						<input type="radio" <?php echo $this->redemption->status_of_redemption == 4 ? 'checked="checked"':'';?> value="4" id="deliver_to_outlet" name="status_of_redemption" class="status_of_redemption" />
						<?php 
							if($this->redemption->status_of_redemption == 4){
								echo '<span class="status_of_card_date" style="color: #ff0000; padding-left: 15px;">' ;
								echo ($this->redemption->status_of_redemption_date != '0000-00-00') ? $this->redemption->status_of_redemption_date : '' ;
								echo '</span>' ;
							}
						?> &nbsp;
					</td>
				</tr>
				<tr>
					<td width='50'>&nbsp;</td>
					<td><?php echo 'Guest picked up' ; ?></td>
					<td width="100px;">
						<input type="radio" <?php echo $this->redemption->status_of_redemption == 5 ? 'checked="checked"':'';?> value="5" id="picked_up" name="status_of_redemption" class="status_of_redemption" />
						<?php 
							if($this->redemption->status_of_redemption == 5){
								echo '<span class="status_of_card_date" style="color: #ff0000; padding-left: 15px;">' ;
								echo ($this->redemption->status_of_redemption_date != '0000-00-00') ? $this->redemption->status_of_redemption_date : '' ;
								echo '</span>' ;
							}
						?> &nbsp;
					</td>
				</tr>
			</table>
			<table>
				<tr>
					<td><label for="title"><?php echo 'Pick up at:' ; ?></label></td>
					<td><?php echo $this->lists['pick_up_oulet'] ; ?></td>
				</tr>
				<?php if(($this->redemption->pick_up_date != '0000-00-00 00:00:00') && !empty($this->redemption->pick_up_date)):?>
				<tr>
					<td><label for="title"><?php echo 'Pick up date:' ; ?></label></td>
					<td>
						<?php
							echo JHTML::_ ( 'calendar', ($this->redemption->pick_up_date != '0000-00-00') ? $this->redemption->pick_up_date : '', 'pick_up_date', 'pick_up_date', '%Y-%m-%d' );
						?>
					</td>
				</tr>
				<?php endif; ?>
			</table>		
		</fieldset>
	</div>
	<input type="hidden" name="controller" value="profile" />
	<input type="hidden" name="option" value="com_wrd" />
	<input type="hidden" name="id" value="<?php echo $this->redemption->id ; ?>" />
	<input type="hidden" name="user_id" value="<?php echo $this->redemption->user_id ; ?>" />
	<input type="hidden" name="task" value="" />
	<?php echo JHTML::_( 'form.token' ); ?>
</form>